<?php

require_once(dirname(__FILE__).'/../ApiPool.php');

//
ApiPool::setRequestSrc("chuanqi");

//
{

	//
	$api_pool = new ApiPool();
	$api_pool->setServer("10.241.12.117", 10006, false);
	
	
	
	
	
	$test_case = array(
		array("Shorten.MakeShortUrlByLongUrl", array("url"=>" http://www.snda.com")),
		array("Foo.Timeout", array()),
		array("Relation.getRelationType", array('sdid' => '1182313348', 'friend_sdids'=>'1247845540, 1272823740, 12331344543', 'judge_type'=>1)),
		array("Relation.getRelationReverse",  array('sdid' => '1182313348', 'start'=>0, 'count'=>5),),
		array("Feed.getFeed", array('sdid' => '1115596664')),
		array("Feed.deleteFeed", array('sdid' => '1186682271', 'appid' => '4', 'fid' => '01000000000000290000012c3e21136b')),
		array("Tuita.getUserTimeline", array('sdid' => '1186682271', 'source_app' => '', 'start' => 0, 'limit'=>20)),
		array("Tuita.delete", array('sdid'=>'1181701872','tuita_id'=>'713cfce2ebf011dfaea3000c29a1cc9d')),
		array("Tuita.getHotTuita", array('tab_name'=>'happen','type'=>0,'start'=>0,'limit'=>20,'source_app'=>'1000000086')),
		array("Medal.getUserDoneMedal", array('sdid' => '1186531717')),
		array("Store.getUserRecentAppList", array('sdid' => '1186531717')),
		array("Search.getRecommend", array('sdid'=>'1211449206')),
		array("Search.searchByName", array('nick'=>'sabrina')),
		array("Search.searchByNameFuzzy", array('nick'=>'sab')),
		array("Search.searchUserNearMe", array('sdid'=>'1211449206')),
		array("Search.searchUser", array('sdid'=>'1211449206','conditions'=>array('university'=>array('school_name'=>'北京大学','school_year'=>'1997','school_class'=>'机械')))),
		array("Search.getRelationDesc", array('sdida'=>'1211449206','sdidb'=>'1192245617')),
	);
	
	$case = 6;
	//
	$response = $api_pool->request($test_case[$case][0], /**/
				$test_case[$case][1],  /**/
				10000 /*(ms)*/
				);
	
	var_dump($response);
	
	//
	if($response->getError() == null) //
	{
		if ($response->getAppErrorCode() == 0) //
		{
			$data = $response->getAppData();
			var_dump("app result = ".$data);
		}
		else //
		{
			$app_error_code = $response->getAppErrorCode();
			$app_error_info = $response->getAppErrorInfo();
			var_dump("app error code = ".$app_error_code);
			var_dump("app error info = ".$app_error_info);
		}
	}
	else //
	{
		var_dump("error code = ".$response->getError());
		var_dump("error info = ".$response->getErrorInfo());
	}

}

exit;

//
{

	//
	$api_pool = new ApiPool();
	$api_pool->setServer("10.241.12.117", 10005, true);
	
	for ($i=0; $i<100; $i++) 
	{
		//
		$response = $api_pool->request('Relation.getRelationType', /**/
					array('url' => 'http://zhidao.baidu.com/question/64098033.html?si=1&wtp=wk'),  /*�������*/
					1000 /*(ms)*/
					);
		
        var_dump($response);
		//
		if($response->getError() == null && false) //
		{
			if ($response->getAppErrorCode() == 0) //
			{
				$data = $response->getAppData();
				var_dump("app result = ".$data);
			}
			else //
			{
				$app_error_code = $response->getAppErrorCode();
				$app_error_info = $response->getAppErrorInfo();
				var_dump("app error code = ".$app_error_code);
				var_dump("app error info = ".$app_error_info);
			}
		}
		else //
		{
			var_dump("error code = ".$response->getError());
			var_dump("error info = ".$response->getErrorInfo());
		}
	}

}
?>
